export default function fibDp(n: number): number {
  const dp: number[] = [];
  dp[0] = 0;
  dp[1] = 1;
  dp[2] = 1;
  for (let i = 3; i <= n; i++) {
    if (i <= 1) {
      dp[i] = i;
      continue;
    }

    dp[i] = dp[i - 1] + dp[i - 2];
  }

  return dp[n];
}

console.log(fibDp(10));
